<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="menu" content="mainMenu" />
<meta name="nav" content="0" />
<meta name="acc" content="0" />
<title>用户部门</title>
<script>
	$(document).ready(function() {
		$("input[name='startDate']").addClass("Wate").bind("focus", function() {
			WdatePicker({
				skin : 'whyGreen',
				minDate : '1900-10-01',
				maxDate : '#F{$dp.$D(\'startDate\')||\'%y-%M-%d\'}',
				dateFmt : 'yyyy-MM-dd'
			});
		});
		$("input[name='endDate']").addClass("Wate").bind("focus", function() {
			WdatePicker({
				skin : 'whyGreen',
				minDate : '#F{$dp.$D(\'endDate\')}',
				dateFmt : 'yyyy-MM-dd'
			});
		});
		$("#liNum").focus();
	});

	function changeDepName() {
		var url = "<c:url value='/account/api/department.action'/>";
		var obj = new Object();
		mm = window
				.showModalDialog(
						url,
						obj,
						'dialogHeight:500px;dialogWidth:780px;status:no;toolbar:no;resizable:no;menubar:no;location:no;scrollbars:no;dialogLeft:'
								+ (screen.width / 2.0 - 150) + ',dialogTop:170')
		if (mm != null) {
			$("input[name='department.id']").val(mm.id);
			$("input[name='department.depName']").val(mm.depName);
		}
	}

	function checkUser() {
		var url = "<c:url value='/account/api/user.action'/>";
		var obj = new Object();
		mm = window
				.showModalDialog(
						url,
						obj,
						'dialogHeight:500px;dialogWidth:780px;status:no;toolbar:no;resizable:no;menubar:no;location:no;scrollbars:no;dialogLeft:'
								+ (screen.width / 2.0 - 150) + ',dialogTop:170')
		if (mm != null) {
			$("input[name='user.id']").val(mm.id);
			$("input[name='user.name']").val(mm.name);
		}
	}
</script>
</head>
<body>
	<h2>
		<s:if test="id == null">添加</s:if>
		<s:else>修改</s:else>
		用户部门信息
	</h2>
	<form action="user_department!save.action" method="post" class="yform"
		id="mainForm">
		<input type="hidden" name="id" value="${id }" />
		<table class="noborder">
			<tr class="type-text">
				<td>姓名</td>
				<td>
					<input type="hidden" name="user.id" value="${user.id }"/>
					<input type="text" name="user.name" value="${user.name }"/>
					<div class="type-button">
						<input type="button" onclick="checkUser()" value="选择"/>
					</div>
				</td>
			</tr>
			<tr class="type-text">
				<td>部门名称</td>
				<td><input type="hidden" name="department.id"
					value="${department.id}" /> <input type="text"
					name="department.depName" value="${department.depName }" />
					<div class="type-button">
						<input type="button" onclick="changeDepName()" value="选择"/>
					</div>
				</td>
			</tr>
			<tr class="type-text">
				<td>职务</td>
				<td><input type="text" value="${officalPosition }"
					name="officalPosition" /></td>
			</tr>
			<tr class="type-text">
				<td>开始时间</td>
				<td><input type="text" id="startDate" name="startDate" value="${startDate }" />
				</td>
			</tr>
			<tr class="type-text">
				<td>结束时间</td>
				<td><input type="text" id="endDate" name="endDate" value="${endDate }" /></td>
			</tr>
			<tr class="type-text">
				<td>备注</td>
				<td><textarea rows="" cols="" name="remark">${remark }</textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<div class="type-button">
						<security:authorize ifAnyGranted="ROLE_修改用户">
							<input   type="submit" class="submit" value="提交" />&nbsp;
					</security:authorize>
						<input   type="button" value="返回" class="reset"
							onclick="history.back()" />
					</div>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>